﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace LyyCMS.Core.Models
{
    public class Blog
    {
        [DisplayName("序号")]
        public virtual int Id { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        [DisplayName("标题")]
        public virtual string Title { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        [DisplayName("内容")]
        public virtual string Content { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [DisplayName("创建时间")]
        public virtual DateTime? Create_At { get; set; }

        [DisplayName("创建人")]
        public virtual int UserId { get; set; }
     

        /// <summary>
        /// 分类
        /// </summary>
        [DisplayName("分类")]
        public virtual BlogCategory Category { get; set; }

        /// <summary>
        /// 评论
        /// </summary>
        public virtual ICollection<Comments> Comments { get; set; }

        [NotMapped]
        [DisplayName("博客")]
        public string DisplayName
        {
            get { return this.Title + "[" + this.Create_At?.ToString("yyyy-MM-dd") + "]"; }
        }
    }
}
